function [ output_args ] = ld_deriv( NUMSV )
%UNTITLED3 Summary of this function goes here
%   Detailed explanation goes here


%C
%C-------------------------------------------------------------------------
%C  
%C  This module loads the function initial data into the variable ( V ) and 
%C  variable derivative ( DER ) arrays.  The data is loaded from the C
%C  array, where the initial values are loaded by the input deck and 
%C  modules.
%C
%C--Argument List Definition---------------------------------------------
%C
%C  NUMSV - (I) Input.  The number of state variables.  This was made a 
%C          passed variable due because different code locations used a 
%C          different variable in this position. 
%C   
%C-------------------------------------------------------------------------
%C  
%C
      COMMON          C(3510)
C 
      DIMENSION  DER(101), IPL(100), V(101), IPLV(100)
C
      EQUIVALENCE (C(2000), TIME    )
      EQUIVALENCE (C(2562), IPL(1)  )
      EQUIVALENCE (C(2664), DER(1)  )
      EQUIVALENCE (C(2765), V(1)    )
      EQUIVALENCE (C(2867), IPLV(1) )
C
C
      DO I = 2, NUMSV
C
C        Get the pointer into the C array for the state variable 
C        derivative.
C
         NODERIV  = IPL( I - 1 ) 
C
C        Get the pointer into the C array for the stage variable.
C
         IF( IPLV( I-1 ) .LT. 1 ) THEN
             NOSTATE = NODERIV + 3 
         ELSE
             NOSTATE = IPLV( I-1 )
         ENDIF
C
C        Load the variable array with the initial value.
C
         V( I ) = C( NOSTATE )
C
C        Load the derivative array with the derivative initial value.
C
         DER( I ) = C( NODERIV )
      ENDDO
C
C     The first integration variable is always time.  Initialize this
C     variable.
C
      V(1) = TIME
C
C
      RETURN
      END

end

